package com.bwie.controller;

import com.bwie.pojo.TbOrder;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 小薛超人
 * @version 1.0
 * @description: TODO
 * @date 2025/7/23 14:14
 */
@RestController
@RequestMapping("/prod/order")
@Api(tags = "订单操作")
public class OrderController {
    @Autowired
    TbOrderService tbOrderService;

    @PostMapping("/getOrderList")
    @ApiOperation(value = "订单列表")
    public R getOrderList(@RequestBody PageInfoVo pageInfoVo){
        return tbOrderService.getOrderList(pageInfoVo);
    }

    @PostMapping("/addOrder")
    @ApiOperation(value = "添加订单")
    public R addOrder(@RequestBody List<TbProdInfo> infoList){
        return tbOrderService.addOrder(infoList);
    }

    @GetMapping("/exportOrderList/{userId}")
    @ApiOperation(value = "导出订单")
    public R exportOrderList(@PathVariable("userId") Integer userId){
        return tbOrderService.exportOrderList(userId);
    }


    @PostMapping("/deleteOrder")
    @ApiOperation(value = "批量删除订单")
    public R deleteOrder(@RequestBody List<Integer> ids){
        return tbOrderService.deleteOrder(ids);
    }

























}
